package test1;

class  Animal{
    protected String name;
    public Animal(String name){
        this.name = name;
    }
}

interface IAmphibious extends IRun,IFly,ISwim{

}

class Dog extends Animal implements IRun{
    public Dog(String name){
        super(name);
    }
    @Override
    public void run(){
        System.out.println(this.name+"正在奔跑.....");
    }
}

class Fish extends Animal implements ISwim{
    public Fish(String name){
        super(name);
    }
    @Override
    public void swim(){
        System.out.println(this.name+"正在游泳....");
    }
}

/*class Duck extends Animal implements ISwim,IRun,IFly{
    public Duck(String name) {
        super(name);
    }

    @Override
    public void fly() {
        System.out.println(this.name+"正在飞.....");
    }

    @Override
    public void run() {
        System.out.println(this.name+"正在跑.....");
    }

    @Override
    public void swim() {
        System.out.println(this.name+"正在游.....");
    }
}*/

class Duck extends Animal implements IAmphibious{
    public Duck(String name) {
        super(name);
    }

    @Override
    public void fly() {
        System.out.println(this.name+"正在飞.....");
    }

    @Override
    public void run() {
        System.out.println(this.name+"正在跑.....");
    }

    @Override
    public void swim() {
        System.out.println(this.name+"正在游.....");
    }
}

public class test {
    public static void IRunning(IRun run){
        run.run();
    }
    public static void main(String[] args) {
        Dog dog = new Dog("大黄");
        Fish fish = new Fish("小蓝");
        Duck duck = new Duck("小鸭");
        IRunning(dog);
        IRunning(duck);

    }
}
